package com.hksj.Intelligentmanagement.controller;

import com.hksj.Intelligentmanagement.common.Result;
import com.hksj.Intelligentmanagement.dto.AlarmConfigurationDTO;
import com.hksj.Intelligentmanagement.service.AlarmConfigurationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName AlarmConfigurationController
 * @Author zengke
 * @Date 2023/7/17 16:48
 */

@RestController
@Api(tags = "告警配置管理")
@RequestMapping("/api/alarmConfiguration")
public class AlarmConfigurationController {

    //注入
    @Autowired
    private AlarmConfigurationService alarmConfigurationService;

/*    @Autowired
    private GasHistoryService gasHistoryService;

    @Autowired
    private GasInfoService gasInfoService;

    @Autowired
    private AlarmRecordService alarmRecordService;*/


    @ApiOperation("新增告警配置")
    @PostMapping("/createAlarmConfiguration")
    public Result createAlarmConfiguration(@RequestBody @Validated(AlarmConfigurationDTO.Create.class) AlarmConfigurationDTO alarmConfigurationDTO){
        return alarmConfigurationService.createAlarmConfiguration(alarmConfigurationDTO);
    }

    @ApiOperation("更新告警配置")
    @PutMapping("/updateAlarmConfiguration")
    public Result updateAlarmConfiguration(@RequestBody @Validated(AlarmConfigurationDTO.Update.class) AlarmConfigurationDTO alarmConfigurationDTO){
        return alarmConfigurationService.updateAlarmConfiguration(alarmConfigurationDTO);
    }

    @ApiOperation("删除告警配置")
    @DeleteMapping("/deleteAlarmConfiguration/{id}")
    public Result deleteAlarmConfiguration(@PathVariable String id){
        return alarmConfigurationService.deleteAlarmConfiguration(id);
    }

    @ApiOperation("查询告警配置列表")
    @PostMapping("/queryAlarmConfigurationList")
    public Result queryAlarmConfigurationList(@RequestBody AlarmConfigurationDTO alarmConfigurationDTO) {
        return Result.data(alarmConfigurationService.queryAlarmConfigurationList(alarmConfigurationDTO));
    }

/*    @ApiOperation("新增气体历史")
    @PostMapping("/createGasHistory")
    public Result createGasHistory(@RequestBody GasHistoryEntity gasHistoryEntity){
        return gasHistoryService.createGasHistory(gasHistoryEntity);
    }

    @ApiOperation("新增气体信息")
    @PostMapping("/createGasInfo")
    public Result createGasInfo(@RequestBody GasInfoEntity gasInfoEntity){
        return gasInfoService.createGasInfo(gasInfoEntity);
    }

    @ApiOperation("新增气体告警记录")
    @PostMapping("/alarmRecordService")
    public Result createAlarmRecord(@RequestBody AlarmRecordEntity alarmRecordEntity){
        return alarmRecordService.createAlarmRecord(alarmRecordEntity);
    }*/


}
